package com.tianquan.miracle.context;/**
 * @author starsea
 * @date 2024-09-28 下午9:53
 */

import com.tianquan.miracle.util.MiracleUtils;
import com.tianquan.miracle.util.ServiceClassLoader;

/**
 * @BelongsProject: uploaddemo
 * @BelongsPackage: com.tianquan.miracle.context
 * @Author: tianquan
 * @CreateTime: 2024-09-28  21:53
 * @Description: 模版容器
 * @Version: 1.0
 */
public class MiracleApplicationContext{

    static ApplicationContext applicationContext;

    public static ApplicationContext refresh(Class clazz, String[] args) {
        // 创建容器
         applicationContext = new DefaultApplicationContext(clazz,args);
        // 初始化工具类
        initUtil(applicationContext);
        // 刷新容器
        applicationContext.refresh();
        return applicationContext;
    }

    private static void initUtil(ApplicationContext applicationContext) {
        ServiceClassLoader.init(applicationContext);
        MiracleUtils.init(applicationContext);
    }

}
